package com.cl.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.List;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.cl.utils.PageUtils;
import com.cl.utils.Query;

import com.cl.dao.LiuyanDao;
import com.cl.entity.LiuyanEntity;
import com.cl.service.LiuyanService;

@Service("liuyanService")
public class LiuyanServiceImpl extends ServiceImpl<LiuyanDao, LiuyanEntity> implements LiuyanService {

    @Override
    public List<LiuyanEntity> selectListView(Wrapper<LiuyanEntity> wrapper) {
        return null;
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        EntityWrapper<LiuyanEntity> liuyanEntityEntityWrapper = new EntityWrapper<>();
        Object jieshouren = params.get("jieshouren");
        LiuyanEntity entity = new LiuyanEntity();
        if (jieshouren != null) {
            entity.setJieshouren((String) jieshouren);
        }
        Object liuyanren = params.get("liuyanren");
        if (liuyanren != null) {
            entity.setLiuyanren((String) liuyanren);
        }
        liuyanEntityEntityWrapper.setEntity(entity);
        Page<LiuyanEntity> page = this.selectPage(
                new Query<LiuyanEntity>(params).getPage(),
                liuyanEntityEntityWrapper
        );
        return new PageUtils(page);
    }
    
    @Override
    public List<LiuyanEntity> selectListView(String jieshouren) {
        return baseMapper.selectListView(jieshouren);
    }
    
    @Override
    public PageUtils queryPage(Map<String, Object> params, Wrapper<LiuyanEntity> wrapper) {
        Page<LiuyanEntity> page = this.selectPage(
                new Query<LiuyanEntity>(params).getPage(),
                wrapper
        );
        return new PageUtils(page);
    }
} 